package com.tien.dao.impl;

import java.util.List;

import org.springframework.stereotype.Component;

import com.tien.dao.UserDao;
import com.tien.model.User;

/**
 *
 * @author  Tian 
 * @Mail    tianxin_star@163.com
 * @version date：Mar 9, 2012 1:51:36 PM
 * 
 */
@SuppressWarnings("rawtypes")
@Component
public class UserDaoImpl extends BaseDaoImpl implements UserDao {

	@Override
	public User getUserByUserName(String username) {
		String hql = "from User where NAME = ?";  
		Object o = this.findEntityByHQL(hql, username);
		return (User) o;
	}

	@SuppressWarnings("unchecked")
	@Override
	public List<User> findAllUsers(int start, int limit) {
		String hql = "from User";
		return this.getEntitiesByHQL(hql, start, limit);
	}

	@Override
	public Long findAllUsersTotalRows() {
		return this.countEntitiesByHQL("select count(*) from User");
	}

	@Override
	public Long updateUser(User user) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public Long addUser(User user) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public void deleteUserById(Long id) {
		// TODO Auto-generated method stub
		
	}

}
